<script setup>
import Vrouter from "@/router"
import { ref, inject } from 'vue'
import { MYURL } from '@/utils/express/express.js'
import { feedback } from '@/api/FeedBack/FeedBack.js'
const change_success = inject('change_message_state')
let imgURL = `${MYURL}/public/icon/back_black.png`
const router = Vrouter
const message = ref(null)
const call = ref(null)
const feed = () => {
    const data = {
        message: message.value,
        call: call.value

    }
    feedback(data).then((res) => {
        message.value = ''
        call.value = ''
        change_success(res.data.message)
    })
}

</script>


<template>
    <div class="back-ground"></div>
    <div class="get-back-main" ref="get_back_main">
        <img class="back-image" ref="back_image" :src="imgURL" @click="router.go(-1)">
        <div class="title">
            <p>反馈</p>
        </div>
    </div>
    <div class="question_input">
        <textarea v-model="message" type="text" placeholder="请说出您要反馈的问题"> </textarea>
        <p @click="feed">反馈</p>
    </div>
    <div class="how_call">
        <p>联系方式</p>
        <input v-model="call" type="text" placeholder="请留下您的联系方式吧">
    </div>
</template>


<style lang="less" scoped>
.back-ground {
    position: fixed;
    top: 0;
    left: 0;
    background-color: #f2f3f5;
    width: 100vw;
    height: 100vh;
    z-index: -1;
}

.get-back-main {
    height: 40px;
    position: sticky;
    z-index: 100;

    .back-image {
        width: 20px;
    }
}

.question_input {
    position: relative;
    margin: 30px auto;
    overflow: hidden;
    border-radius: 20px;
    width: 90vw;
    height: 20vh;
    background-color: white;

    textarea {
        resize: none;
        padding: 10px;
        border: none;
        outline: none;
        width: 100%;
        height: 15vh;
    }

    p {
        position: absolute;
        right: 2%;
        bottom: 4%;
        color: white;
        background-color: var(--bilibili-pink);
        border-radius: 10px;
        font-size: 13px;
        padding: 3px 8px;
    }

}

.how_call {
    padding: 0 10px;
    margin: 0 auto;
    margin-left: 5vw;
    width: 90vw;
    display: flex;
    align-items: center;
    background-color: white;
    border-radius: 10px;

    input {
        margin-left: 5px;
        height: 5vh;
        border: none;
        outline: none;
        flex: 1;
    }

    p {
        font-size: 14px;
        font-weight: 600;
    }
}
</style>